﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;

namespace ExpertMIS.Forums
{
    public partial class Visitor : System.Web.UI.MasterPage
    {
        public event EventHandler OnLoadLeftPanels;

        protected void LoadLeftPanels()
        {
            if (null != OnLoadLeftPanels) OnLoadLeftPanels(this, null);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            //window.external.AddFavorite('http://www.qjzjzx.com', '曲靖专家在线网')
            ContentPlaceHolder2.Visible = !string.IsNullOrEmpty(Subtitle);
            LoadLeftPanels();
        }

        protected string GetWelcomeText()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("欢迎您，");
            sb.Append(ExpertMIS.Codes.Utility.GetCurrentUsername());

            if (ExpertMIS.Codes.Utility.IsLogon)
            {
                sb.Append(string.Format(" <a><span>注销</span></a>"));
            }
            else
            {
                sb.Append(
                    string.Format(
                    " <a href='{0}Login.aspx'><span>登录</span></a> | <a href='{0}Forums/Register.aspx'><span>注册</span></a>",
                   ResolveClientUrl("~"))
               );
            }

            return sb.ToString();
        }

        public Control LeftPanel
        {
            get
            {
                return leftPanel;
            }
        }

        public string Subtitle
        {
            get;
            set;
        }
    }
}
